﻿@model IEnumerable<EShopV20.Areas.Adm.Models.ReportInfo>

<h2>@ViewBag.Title</h2>

<table class="table">
    <tr>
        <th>Group</th>
        <th>Sum</th>
        <th>Count</th>
        <th>Min</th>
        <th>Max</th>
        <th>Avg</th>
    </tr>
    @foreach (var r in Model)
    {
    <tr>
        <td>@r.Group</td>
        <td>@r.Sum</td>
        <td>@r.Count</td>
        <td>@r.Min</td>
        <td>@r.Max</td>
        <td>@r.Avg</td>
    </tr>    
    }
</table>

<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
    google.load("visualization", "1", { packages: ["corechart"] });
    google.setOnLoadCallback(drawChart);
    function drawChart() {

        var data = google.visualization.arrayToDataTable([
          ['Nhóm', 'Giá trị'],
          @foreach (var r in Model)
          {
              <text>["@r.Group", @r.Count],</text>
          }
        ]);

        var options = {
            title: 'Thống kê tồn kho'
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
    }
</script>
<div id="piechart" style="width: 900px; height: 500px;"></div>

